package com.chuangjiangx.member.manager.web.web.basic.request;


import com.chuangjiangx.commons.request.PageRequest;
import com.fasterxml.jackson.annotation.JsonFormat;
import lombok.Data;

import javax.validation.constraints.NotNull;
import java.util.Date;

@Data
public class CountByStoreRequest extends PageRequest {

    /**
     * 开始时间
     */
    @NotNull(message = "{member.startTime.null}")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date startTime;

    /**
     * 结束时间
     */
    @NotNull(message = "{member.endTime.null}")
    @JsonFormat(pattern = "yyyy-MM-dd", timezone = "GMT+8")
    private Date endTime;

    public void setEndTime(Date endTime) {
        if (endTime != null) {
            endTime.setTime(endTime.getTime() + 23 * 60 * 60 * 1000 + 59 * 60 * 1000 + 59 * 1000);
        }
        this.endTime = endTime;
    }
}
